//==================================================================
//  Copyright (C) 2006  Davide Pasca
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//==================================================================
//==
//==
//==
//==================================================================

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "m5d_light.h"
#include "pmatrix.h"

//==================================================================
namespace M5D
{

//==================================================================
Light::Light( Scene *scenep, const char *namep, Light *copy_fromp ) :
	Model(Model::TYPE_LIGHT, scenep, namep),
	_type(LIGHT_TYPE_DIR),
	_pos(0,0,1,0),
	_col(1,1,1)
{
	if ( copy_fromp )
	{
		_type		= copy_fromp->_type;
		_box_min	= copy_fromp->_box_min;
		_box_max	= copy_fromp->_box_max;
		_pos		= copy_fromp->_pos;
		_col		= copy_fromp->_col;
	}
	else
	{
		_box_min.SetMaxValue();
		_box_max.SetMinValue();
	}
}

//==================================================================
Light::~Light()
{
}

//==================================================================
const Vector4 Light::CalcGlobalPos() const
{
	return _mod_global_m * _pos;
}

};